﻿@model IEnumerable<FreightSoft.Models.CUSTOMER_ORDER>

@{
    ViewBag.Title = "AddOrders";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Add Orders to Shipment - @ViewBag.SHIPMENT_ID</h2>

<table class="table table-striped">
    <tr>
        <td colspan="4">
            @if (TempData["error"] != null)
            {
                <div class="alert alert-danger">@TempData["error"]</div>
            }
        </td>
    </tr>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ORDER_ID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CUSTOMER_ID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AUTHORIZOR)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PRIORITY)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.WANTED_DELIVERY_DATE)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DELIVERY_ADDRESS)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.FORWARDER_ID)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.SOURCE)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DESTINATION)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.STATUS) 
        </th>

    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ORDER_ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CUSTOMER_ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AUTHORIZOR)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PRIORITY)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.WANTED_DELIVERY_DATE)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DELIVERY_ADDRESS)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FORWARDER_ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SOURCE)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DESTINATION)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.STATUS)
        </td>
        <td>
            @Html.ActionLink("Add", "AddOrder", "ShipmentLine", new { shipment_id= @ViewBag.SHIPMENT_ID, order_id = item.ORDER_ID, customer_id = item.CUSTOMER_ID}, null) 
            @*@Html.ActionLink("Use This addd", "AddOrder", new { /* id=item.PrimaryKey */ }) |*@
            @*@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |*@
           @* @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })*@
        </td>
    </tr>
}

</table>
<p> @Html.ActionLink("Back to Shipment", "Details", "Shipment",  new { id = @ViewBag.SHIPMENT_ID }, null)

</p>
